package com.lcc.myblog.controller;

import com.lcc.lynx.base.system.pojo.dv.SysUserDV;
import com.lcc.lynx.common.ResultVO;
import com.lcc.lynx.security.Session;
import com.lcc.lynx.security.annotation.Anonymous;
import com.lcc.lynx.security.pojo.UserInfo;
import com.lcc.myblog.service.BkArticleService;
import com.lcc.myblog.pojo.dv.BkArticleDV;
import com.lcc.lynx.jdbc.IByIdController;
import lombok.AllArgsConstructor;
import org.apache.catalina.manager.util.SessionUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
/** 
 * 文章管理控制实现
 * @auth lcc
 * @date 2025-03-25
 */
@RestController
@AllArgsConstructor
@RequestMapping("/bk/article")
public class BkArticleController implements IByIdController<BkArticleDV> {

    private BkArticleService service;
    

    @Override
    public BkArticleService getService() {
       return service;
    }

    @RequestMapping("/save2")
    public ResultVO save2(@RequestBody BkArticleDV dv){
        SysUserDV user = Session.getUser();
        if(user == null){
            return ResultVO.fail("请先登录");
        }
        dv.setUserId(user.getUserId());
        service.save(dv);
        return ResultVO.success();
    }


}